"use client";

import { useWeather } from "@/api";
import Detail from "./_cmp/detail";
import { useSearchParams } from "next/navigation";

export default function Page() {
  const searchParams = useSearchParams();
  const city = searchParams.get("city") || "北京";
  const { data: { data } = {} } = useWeather({ city });
  return (
    <>
      <div className="flex items-center justify-center h-screen flex-col">
        <div>
          {data?.city} {data?.weather}
        </div>
        <hr className=" w-full py-2" />
        <Detail />
      </div>
    </>
  );
}
